﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PutToEntry.aspx.cs" Inherits="com.vs.RF.Web.task.PutToEntry"   MasterPageFile="~/RF.Master" %>
<%@ Import Namespace="com.vs.DataAccess.DO" %>
<%@ Import Namespace="com.vs.General.RF" %>
<asp:Content ID="Content1" ContentPlaceHolderID="body" runat="server">
    <script type="text/javascript">
        function valForm() {
            if (form1.tbLoc.value == "") {
                alert("请输入货位");
                this.form1.tbLoc.focus();
                return false;
            }

            if (form1.tbLoc.value != '<%=tskDtlDO.TO_LOC %>') {
                alert("输入了错误的库位");
                form1.tbLoc.select();
                return false;
            }
            
            if (form1.tbLPN.value == "") {
                alert("请输入LPN");
                form1.tbLPN.focus();
                return false;
            }

            if (form1.tbLPN.value != '<%=tskDtlDO.FROM_LPN %>') {
                alert("输入了错误的LPN");
                form1.tbLPN.select();
                return false;
            }
            
            if (form1.tbQty.value == "") {
                alert("请输入数量");
                form1.tbQty.focus();
                return false;
            }
            
            if (isNaN(form1.tbQty.value)){
                alert("请输入有效数量");
                form1.tbQty.focus();
                return false;
            }
            
            if (form1.tbQty.value <= 0){
                alert("请输入有效数量");
                form1.tbQty.focus();
                return false;
            }                        
            
            if (form1.tbQty.value > <%=tskDtlDO.TO_QTY %>){
                alert("超出未执行的数量");
                form1.tbQty.focus();
                return false;
            }
            
            return true;
        }      

        var iNumOfSubmit = 0;
        function btnOK_Click() {
            if (iNumOfSubmit > 0)
                return;
            if (valForm()) {
                iNumOfSubmit++;
                form1.hdAction.value = "<%= RFSupport.PUTAWAY %>";
                form1.submit();
            }
        }
        
        function btnSkip_Click(){
            if (iNumOfSubmit > 0)
                return;
            if (valForm()) {
                iNumOfSubmit++;
                form1.hdAction.value = "<%= RFSupport.SKIP %>";
                form1.submit();
            }
        }

        function btnCancel_Click() {
            form1.action = "TaskIDEntry.aspx";
            form1.submit();
        }
        
        function on_Load(){
            form1.tbLoc.focus();
        }

        function on_KeyDown() {
            if (event.keyCode == "13")
                btnOK_Click();
        }
        
    </script>
    
    <%= stErrorMessage %>
    
    <form id="form1" action="PutToEntryHandling.aspx" method="post" onkeydown="on_KeyDown()">
    <input type="hidden" name="hdAction" />
    <div>
        <table>
            <tr>
                <td>货号：</td>
                <td><%=tskDtlDO.ITEM %></td>
            </tr>
            <tr>
                <td>名称：</td>
                <td><%=tskDtlDO.ITEM_DESC %></td>
            </tr>
            <tr>
                <td>数量：</td>
                <td><%=tskDtlDO.TO_QTY %>个</td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="text" name="tbQty" value="<%= tskDtlDO.TO_QTY %>"/> 个
                </td>                
            </tr>
            <tr>
                <td>货位：</td>
                <td><%=tskDtlDO.TO_LOC %></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="text" name="tbLoc"/></td>
            </tr>
            <tr>
                <td>托盘：</td>
                <td><%=tskDtlDO.FROM_LPN %></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="text" name="tbLPN" /></td>
            </tr>
        </table>
    
    </div>
    </form>
    
    </div>
    <div id="footer">  
        <input type="button" id="btnOK" value="确定" onclick="btnOK_Click()" class="greyRed"/>
        <input type="button" id="btnSkip"value="跳过" onclick="btnSkip_Click()" class="greyRed" />
        <input type="button" id="btnCancel" value="取消" onclick="btnCancel_Click()" class="greyRed" />
    </div>
    </form>
</asp:Content>
